package com.myway.core.common;

import java.util.HashMap;

/**
 * 类名称：Top1Status
 * 类描述 : 至尊订单状态
 * 创建时间：2016-6-13 上午11:24:10
 * @author hongjun.quan
 * @version V1.0
 */
public enum Top1Status{
	
	/**至尊用车状态 begin**/
	//至尊接口状态
	TBP("TBP"),		//待支付		To be paid
	PDI("PDI"),		//支付确认中	Pay Determine in	
	PAID("PAID"),	//已支付		paid
	HBC("HBC"),		//已取消		Has been canceled
	ABC("ABC"),		//已经完成		Already been completed
	
	//成航本地状态
	ODI("ODI"),		//订单确定中	order Determine in
	EUPDI("EUPDI"),	//支付确认中	Pay Determine in
	CDI("CDI"),		//取消订单确定中	canceled Determine in
	AR("AR"),  		//已退款		Already refund
	RF("RF");  		//退款失败		refund failure
	/**至尊用车状态 end**/
	/**
	 * Alias name. This is the name which will be stored in database.
	 */
	private final String alias;

	/**
	 * A hash map which keep all the action enum with alias name as key.
	 */
	private static HashMap<String, Top1Status> map;

	/**
	 * Construct the hash map at load time
	 */
	static
	{
		map = new HashMap<String, Top1Status>();
		for ( Top1Status type : Top1Status.values() )
		{
			map.put( type.alias, type );
		}
	}

	Top1Status(String alias)
	{
		this.alias = alias;
	}

	@Override
	public String toString()
	{
		return this.alias;

	}

	/**
	 * Return a <code>Action</code> object holding the value of specified alias name
	 * 
	 * @param alias
	 * the alias name of the type
	 * 
	 * @return a <code>Action</code> object holding the value represented by the alias name argument
	 */
	public static Top1Status valueOfAlias(String alias)
	{
		Top1Status type = map.get( alias );

		if ( type == null )
		{
			throw new IllegalArgumentException( "Unknown action alias [" + alias + "]" );
		}

		return type;
	}

	/**
	 * @return the alias
	 */
	public String getAlias()
	{
		return this.alias;
	}

}
